package com.atguigu.wc.source;

import com.atguigu.wc.beans.SensorReading;
import org.apache.flink.streaming.api.datastream.DataStreamSource;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;

import java.util.Arrays;

/**
 * @Author:GaoFei
 * @Description:
 * @Date:Created in 18:11
 * @Modified By:
 */
public class SourceCollection {
    public static void main(String[] args) throws Exception {
        StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
        DataStreamSource<SensorReading> sensorReadingDataStreamSource = env.fromCollection(Arrays.asList(
                new SensorReading("sensor-6", System.currentTimeMillis(), 36.5),
                new SensorReading("sensor-7", System.currentTimeMillis(), 36.5),
                new SensorReading("sensor-8", System.currentTimeMillis(), 36.5),
                new SensorReading("sensor-9", System.currentTimeMillis(), 36.5)
        ));
        sensorReadingDataStreamSource.print("sensor");
        env.execute();
    }
}
